pro test_read_slug
read_slug
a=mrdfitS('$SLUG_DIR/output/SLUG_DEF.fits', 1)
ntags=n_elements(tag_names(a))
nfluxes=ntags-7
int=mrdfitS('$SLUG_DIR/output/integral_SLUG_DEF.fits', 1)

un=unique(a.age_gal)
print, 'NUMBER OF UNIQUE TIMESTEPS FOUND:', n_elements(un)
print, 'NUMBER FLUXES FOUND:', nfluxes
for i=0, n_elements(un)-1 do begin
  wh=where(a.age_gal EQ un[i], ct)
  wh_int=where(int.age_gal EQ un[i], ct2)
  if ct2 EQ 0 then continue
  for ij=0, nfluxes-1 do begin
     tot1=total(a[wh].(7+ij))
     print, (tag_names(a))[7+ij], un[i], tot1, int[wh_int].(1+ij), tot1-int[wh_int].(1+ij), $
			(tot1-int[wh_int].(1+ij))/tot1
  endfor
endfor

print, 'TESTING FAST vs SLOW'
print, 'Running Fast'
read_slug, outputname='fasttest.fits'
print, 'Running Slow'
read_slug, outputname='slowtest.fits',/slow

fast=mrdfitS('fasttest.fits', 1)
slow=mrdfits('slowtest.fits', 1)
ntags=n_elementS(tag_names(fast))
for i=0, ntags-1 do print, (tag_names(fast))[i], total(fast.(i)-slow.(i))
help, fast
help, fast, /st
help, slow
help, slow, /st

STOP
end
